Skip to content

fix(editor): expose and align configurable caret geometry - #2759

Open
pangxingzhong1983 wants to merge 2 commits into
singerdmx:masterfrom
pangxingzhong1983:feat/configurable-cursor-dimensions
Open

fix(editor): expose and align configurable caret geometry#2759
pangxingzhong1983 wants to merge 2 commits into
singerdmx:masterfrom
pangxingzhong1983:feat/configurable-cursor-dimensions

Conversation

@pangxingzhong1983

@pangxingzhong1983 pangxingzhong1983 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • expose cursor width, height, radius, offset, and opacity animation through QuillEditorConfig
  • derive platform defaults from the effective theme platform
  • align macOS and iOS caret prototypes and vertical geometry with Flutter RenderEditable
  • make painting, text input geometry, and scrolling share one final pixel-snapped caret rectangle
  • preserve complete child offsets through line, block, and editor coordinate transforms
  • derive inactive-line caret prototypes from the current style instead of stale layout caches

Root cause

The high-level editor did not expose the full cursor geometry contract. Internally, caret painting and getLocalRectForCaret also used different calculations. macOS followed Apple paint behavior but an iOS-only prototype branch, while inactive lines cached old geometry and the editor root dropped horizontal child offsets. This could place a thin caret inside the final glyph and make IME or reveal geometry disagree with the pixels on screen.

Compatibility

All new fields are optional. Existing cursor width still defaults to 2.0, and unset geometry continues to use Flutter platform defaults. copyWith keeps the existing null-means-preserve convention.

Validation

  • targeted cursor and editor tests: 28 passed
  • complete flutter_quill test suite: 121 passed
  • flutter_quill_extensions: 68 passed
  • flutter_quill_test: 1 passed
  • flutter analyze: no issues
  • dart format check: no changes
  • git diff --check: passed

The regression matrix covers Android, Fuchsia, iOS, Linux, macOS, and Windows; DPR 1 and 2; Latin, CJK, empty, and multiline text; inactive-line style updates; explicit zero offset and radius; and centered max-content-width layouts with nonzero padding.

@pangxingzhong1983 pangxingzhong1983 changed the title feat(editor): make cursor width configurable fix(editor): expose and align configurable caret geometry Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant